package com.hmall.order.web;

import com.hmall.common.dto.ResultDTO;
import com.hmall.order.pojo.Order;
import com.hmall.order.pojo.ViewSource;
import com.hmall.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description:
 * @Author: 315QK
 * @Date: 2021/12/21/10:44
 */
@RestController
@RequestMapping("")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @PostMapping("/order")
    public Long saveNewOrder(@RequestBody ViewSource viewSource){
        return orderService.saveNewOrder(viewSource);
    }

    @GetMapping("/order/{id}")
    public Order getOrderById(@PathVariable Long id){
        return orderService.getById(id);
    }
}
